#include<vector>
using namespace std;
class Solution {
public:
    vector<int> trainingPlan(vector<int>& actions) {
        int n = actions.size();
        vector<int> ret(n);
        int left = 0, right = n - 1;
        for (int i = 0; i < n; i++)
            if (actions[i] % 2)ret[left++] = actions[i];
            else ret[right--] = actions[i];
        return ret;
    }
};